import request from '@/utils/request'
import { parseStrEmpty } from "@/utils/ruoyi";

// 查询用户列表
export function listQualitygGroup(query) {
  return request({
    url: '/system/QualitygGroup/list',
    method: 'get',
    params: query
  })
}

// 查询用户详细
export function getQualitygGroup(QualitygGroupId) {
  return request({
    url: '/system/QualitygGroup/' + parseStrEmpty(QualitygGroupId),
    method: 'get'
  })
}

// 新增用户
export function addQualitygGroup(data) {
  return request({
    url: '/system/QualitygGroup',
    method: 'post',
    data: data
  })
}

// 修改用户
export function updateQualitygGroup(data) {
  return request({
    url: '/system/QualitygGroup',
    method: 'put',
    data: data
  })
}

// 删除用户
export function delQualitygGroup(QualitygGroupId) {
  return request({
    url: '/system/QualitygGroup/' + QualitygGroupId,
    method: 'delete'
  })
}

// 用户密码重置
export function resetQualitygGroupPwd(QualitygGroupId, password) {
  const data = {
    QualitygGroupId,
    password
  }
  return request({
    url: '/system/QualitygGroup/resetPwd',
    method: 'put',
    data: data
  })
}

// 用户状态修改
export function changeQualitygGroupStatus(QualitygGroupId, status) {
  const data = {
    QualitygGroupId,
    status
  }
  return request({
    url: '/system/QualitygGroup/changeStatus',
    method: 'put',
    data: data
  })
}

// 查询用户个人信息
export function getQualitygGroupProfile() {
  return request({
    url: '/system/QualitygGroup/profile',
    method: 'get'
  })
}

// 修改用户个人信息
export function updateQualitygGroupProfile(data) {
  return request({
    url: '/system/QualitygGroup/profile',
    method: 'put',
    data: data
  })
}

// 用户密码重置
export function updateQualitygGroupPwd(oldPassword, newPassword) {
  const data = {
    oldPassword,
    newPassword
  }
  return request({
    url: '/system/QualitygGroup/profile/updatePwd',
    method: 'put',
    params: data
  })
}

// 用户头像上传
export function uploadAvatar(data) {
  return request({
    url: '/system/QualitygGroup/profile/avatar',
    method: 'post',
    data: data
  })
}

// 查询授权角色
export function getAuthRole(QualitygGroupId) {
  return request({
    url: '/system/QualitygGroup/authRole/' + QualitygGroupId,
    method: 'get'
  })
}

// 保存授权角色
export function updateAuthRole(data) {
  return request({
    url: '/system/QualitygGroup/authRole',
    method: 'put',
    params: data
  })
}
